import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "./src"),
    },
  },
  server: {
    proxy: {
      "/api": {
        // target: "https://test.qianyuankeji.net", // 目标服务器地址
        target: "http://192.168.230.79:8081", // 目标服务器地址
        changeOrigin: true, // 是否改变请求的 origin
        rewrite: (path) => path.replace(/^\/api/, ""), // 重写路径，去掉 `/api`
      },
    },
  },
});
